<template>
  <view>
    <!-- <img :src="detailsData.icon_url" style="width: 100%; height: 300upx; background: #f0f0f0" /> -->
    <view class="between-center">
      <img
        :src="detailsData.icon_url"
        style="
          width: 150upx;
          height: 150upx;
          background: #f0f0f0;
          border-radius: 20upx;
        "
      />
      <view class="avator between-center">
        <view class="avator_title">
          <view>{{ detailsData.fullname }} </view>
          <view style="font-size: 24upx; font-weight: 300">标签1</view>
        </view>
        <view class="avator_level flex">
          收藏<u-icon name="heart"></u-icon>
        </view>
      </view>
    </view>
    <view>
      <view class="flex report">
        <u-icon name="share"></u-icon>企业介绍资料
      </view>
      <view style="padding: 20upx" class="report_time">
        <view style="margin: 5upx 0"
          >赛道：{{ detailsData.gs_suoshu_hangye }}</view
        >
        <view style="margin: 5upx 0"
          >注册资金：{{ detailsData.gs_zhuce_ziben }}</view
        >
        <view style="margin: 5upx 0"
          >年收入：{{ detailsData.qiye_shouru }}</view
        >
        <view style="margin: 5upx 0"
          >所属区域：{{ detailsData.gs_zhuce_dizhi }}</view
        >
      </view>
      <view class="report_content">
        <view v-if="detailsData.fulltext !== ''">
          <ul>
            <li>{{ detailsData.fulltext }}</li>
          </ul>
        </view>
        <view>
          <ul>
            <li>{{ detailsData.smalltext }}</li>
          </ul>
        </view>
      </view>
      <img
        :src="detailsData.icon_url"
        style="width: 100%; height: 300upx; background: #f0f0f0"
      />
    </view>

    <view style="padding: 0upx 20px" v-if="topCompanyBasicList.length">
      <pageTitle title="企业项目"></pageTitle>
      <mainList :baseList="topCompanyBasicList" />
    </view>
    <view style="padding: 0upx 20px">
      <pageTitle title="企业推荐"></pageTitle>

      <mainList :baseList="tuijian_topCompanyBasicList"  :type="tuijian_qiye"/>
    </view>
  </view>
</template>

<script>
import mainList from "@/components/mainList/index.vue";
import uTabs from "@/components/uTabs/index.vue";
import pageTitle from "@/components/pageTitle.vue";
export default {
  components: {
    mainList,
    uTabs,
    pageTitle,
  },
  data() {
    return {
      array: ["中国", "美国", "巴西", "日本"],
      index: 0,
      tuijian_qiye:'qiye',
      tabBasicList: [
        {
          name: "2024",
        },
        {
          name: "2023",
        },
        {
          name: "2022",
        },
        {
          name: "其他",
        },
      ],
      checkboxValue1: [],
      // 基本案列数据
      checkboxList1: [
        {
          name: "独角兽",
          disabled: false,
        },
        {
          name: "隐形独角兽",
          disabled: false,
        },
        {
          name: "其他",
          disabled: false,
        },
      ],
      topCompanyBasicList: [],
      tuijian_topCompanyBasicList:[],
      detailsData: {},
    };
  },
  onShow() {
    const eventChannel = this.getOpenerEventChannel();
    eventChannel.on("acceptDataFromSourcePage", (data) => {
      this.id = data.param.id;
      this.getDetails(data.param.id);
    });
  },
  methods: {
    async getDetails(id) {
      const res = await this.$api.getCompanyDetails({ id });
      console.log("企业详情数据");
      console.log(res);
      this.detailsData = res;
      console.log(res.xiangmu);
      // this.topCompanyBasicList = res.xiangmu;
      this.topCompanyBasicList = res.xiangmu?.map((item) => {
        return {
          ...item,
          name: item.fullname,
          img_url: item.xiangmu_fengmian_img,
          msg: item.gs_zhuce_dizhi,
          desc_text: item.smalltext,
          tag: item.fulltext,
        };
      });
      this.tuijian_topCompanyBasicList = res.tuijian_qiye?.map((item) => {
        return {
          ...item,
          name: item.simplename,
          img_url: item.icon_url,
          // msg: item.subtype_name,
          city:item.city_name,
          desc_text: item.typename,
          tag: item.smalltext,
        };
      });


    },
  },
};
</script>

<style scoped lang="scss">
.desc {
  margin-top: 20upx;
  font-size: 24upx;
  color: #666;
  margin-bottom: 20upx;
  background: #e5efff;
  padding: 20upx;
}
.report {
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  padding: 20upx 20upx;
  font-size: 28upx;
  margin-top: 20upx;
  > view {
    width: 50%;
  }
}
.report_content {
  > view {
    background: #f0f0f0;
    margin: 20upx;
    padding: 10upx 20upx;
    border-radius: 10upx;
    font-size: 26upx;
    color: #999;
    > ul {
      margin-left: 10upx;
    }
  }
}
.report_time {
  margin: 10upx 0;
  font-size: 24upx;
  color: #999;
  display: flex;
  flex-wrap: wrap;
  > view {
    width: 50%;
  }
}
.avator {
  flex: 1;
  margin-left: 20upx;
  font-size: 32upx;
  padding-right: 20upx;
  .avator_level {
    font-size: 24upx;
    align-self: center;
  }
  .avator_title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}
</style>